home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / ctutor2 / printdat.c < prev    next >
Text File  |  1985-02-05  |  640b  |  22 lines

  1. #include "stdio.h"
  2.  
  3. main()
  4. {
  5. FILE *funny,*printer;
  6. int c;
  7.  
  8.    funny = fopen("TENLINES.TXT","r"); /* open input file     */
  9.    printer = fopen("PRN","w");        /* open printer file   */
  10.  
  11.    do {
  12.       c = getc(funny);    /* got one character from the file */
  13.       if (c != EOF) {
  14.          putchar(c);      /* display it on the monitor       */
  15.          putc(c,printer); /* print the character             */  
  16.       }
  17.    } while (c != EOF);    /* repeat until EOF (end of file)  */
  18.  
  19.    fclose(funny);
  20.    fclose(printer);
  21. }
  22.